<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>帐号管理</title>
<script>
	$(document).ready(function() {
		$("#message").fadeOut(5000);
	});
	$(document).ready(function() {
		$("#errormessage").fadeOut(10000);
	});
</script>
</head>

<body>
	<form:form id="inputForm" modelAttribute="search"
		action="${ctx}/account/user/search" method="post">
		<fieldset class="prepend-top">
			<legend>用户列表查询</legend>
			<label for="userName" class="field">人员用户名:</label><input type="text"
				id="userName" name="userName" size="40" value="${search.userName}" />(非登录名)
			<br>
		</fieldset>
		<div>
			<input id="submit"
				style="margin-left: 450px; text-align: center; width: 120px; height: 30px"
				type="submit" value="查    询" />&nbsp; <input id="reset"
				style="text-align: center; width: 120px; height: 30px" type="reset"
				value="重    置" onclick="reset()" />
		</div>
		<shiro:hasPermission name="user:superedit">
			<h4><a href="create">创建用户</a></h4>
		</shiro:hasPermission>
	</form:form>
	<h4 class="prepend-top">用户列表</h4>
	<c:if test="${not empty message}">
		<div id="message" class="success">${message}</div>
	</c:if>
	<c:if test="${not empty errormessage}">
		<div id="errormessage" class="error">${errormessage}</div>
	</c:if>
	<table id="contentTable">
		<tr>
			<th>登录名</th>
			<th>用户名</th>
			<th>邮箱</th>
			<th>权限组
			<th>操作</th>
		</tr>
		<c:forEach items="${users}" var="user">
			<tr>
				<td>${user.loginName}</td>
				<td>${user.name}</td>
				<td>${user.email}</td>
				<td>${user.groupNames}</td>
				<td><shiro:hasPermission name="user:superedit">
						<a href="update/${user.id}" id="editLink-${user.name}">修改</a>
						<a href="delete/${user.id}">删除</a>
					</shiro:hasPermission></td>
			</tr>
		</c:forEach>
	</table>

</body>
</html>
